{# src/Pyaf/GymBundle/Resources/views/AdminGrupoMuscular/list.html.twig #}
{% extends "PyafGymBundle::layout_admin.html.twig" %}

{% block title %} Pyaf {% endblock %}
{% block tituloSector %}<i class=" icon-list-alt"></i> Rutinas - Administrar Grupos Musculares {% endblock %}
{% block nombreSector %} Rutinas / Grupos Musculares{% endblock %}
{% block dashboardContent %}{% endblock %}

{% block content %}
    <div class="container-fluid" id="content-area" style="padding-right: 30px;">     
        
        {% if app.session.hasFlash('alertaGruposMuscularesSuccess') %}
            <div class="alert alert-success">
                <button type="button" class="close" data-dismiss="alert">&times;</button>
                {{ app.session.flash('alertaGruposMuscularesSuccess') }}
            </div>
        {% endif %}
        {% if app.session.hasFlash('alertaGruposMuscularesError') %}
            <div class="alert alert-error">
                <button type="button" class="close" data-dismiss="alert">&times;</button>
                {{ app.session.flash('alertaGruposMuscularesError') }}
            </div>
        {% endif %}
        
    <div class="row-fluid">
        <div class="span12">
            <div class="box">
                <div class="box-head"><i class="icon-table"></i><span>Tablero de Grupos Musculares</span></div>
                <div class="box-body">
                    
                    <div class="span6">
                        <div class="mini-layout">
                            <div class="mini-layout-header">
                                <i class="icon-th-large"></i>
                                <span>Grupos Musculares</span>
                            </div>
                            <div class="mini-layout-body">
                                <table id="table" class="table table-nomargin table-bordered dataTable table-striped table-hover">
                                    <thead><tr>                                              
                                            <th>Nombre</th>
                                            <th>Habilitado</th>
                                            <th>Editar</th>
                                            <th>In/Habilitar</th>
                                    </tr></thead>
                                    <tbody>

                                    {% for grupoMuscular in gruposMusculares %}

                                        <tr style="">
                                            <td><div class="btn-link" onclick='showGrupoMuscular("{{ path('admin_grupomuscular_show', { 'id': grupoMuscular.id }) }}")'>
                                                {{grupoMuscular.nombre}}
                                            </div></td>
                                            <td style="text-align: center;">
                                                {% if grupoMuscular.habilitado %}
                                                    <i class="icon-check"></i>
                                                {% else %}
                                                    <i class="icon-check-empty"></i>
                                                {% endif %}                                            
                                            </td>
                                            <td style="text-align: center;"><div class="btn-link icon-edit" onclick='showGrupoMuscular("{{ path('admin_grupomuscular_edit', {'id': grupoMuscular.id}) }}")'></div></td>
                                            <td style="text-align: center;"><a class="btn-link  icon-remove-sign" href="{{ path('admin_grupomuscular_disable', {'id': grupoMuscular.id}) }}"></div></td>
                                        </tr>

                                    {% endfor %}

                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                    <div class="span6">
                        <div class="mini-layout">
                            <div class="mini-layout-header">
                                <i class="icon-leaf"></i>
                                <span>Grupo Muscular</span>
                                <button class="btn-mini btn-primary text-right offset3" id="newGrupoMuscular">
                                    Agregar nuevo grupo muscular
                                </button>
                            </div>
                            <div class="mini-layout-body">
                                <div id="box-info-grupoMuscular"></div>  
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>            
</div>            
{% endblock %}
    
{% block javascripts %}
    <script type="text/javascript">
       
        function showGrupoMuscular(data){                
            $('#box-info-grupoMuscular').load(data);             
        };

        $(document).ready(function(){
            
            $('#newGrupoMuscular').click(function(){
                showGrupoMuscular("{{ path('admin_grupomuscular_new') }}");
            });
             
        });
    </script>
{% endblock %}